package mainService.services;

import java.util.ArrayList;
import java.util.Collections;

import mainService.HTTPService;
import mainService.ServiceParams;
import mainService.data.IpClient;
import mainService.data.UsersConnected;
import mainService.data.Utente;

/**
 * Servizio di Sintesi degli utenti di un progetto.
 * 
 * @author Mattia Grecchi, Daniel Procop
 */
public class SintesiUsersProjectService extends ReadingServices implements HTTPService {
	
	public SintesiUsersProjectService() {
		super();
	}

	static private ArrayList<String> campiXML = new ArrayList<String>();
	
	static {
		Collections.addAll(campiXML, "username", "role");
	}

	@Override
	public ArrayList<String> getServiceResult(ServiceParams params) {
		
		Utente user = UsersConnected.getUsersConnected().getUtente(
				IpClient.getSingleton().getIp());
		int id_project = user.getId_project();

		String qry="select username, role from users where id_project='"+id_project+"'";
		return getResult(qry, campiXML);
	}

}
